package com.yuanchu.common.exception;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2023-05-11 22:03
 */

//错误码和错误信息定义类：
//        1. 错误码定义规则为五位数字
//        2. 前两位表示业务场景，最后三位表示错误码。例如：100001。10:通用 001:系统未知异常
//        3. 维护错误码后需要维护错误描述，将他们定义为枚举形式
//
//
//        错误码列表（前两位业务场景）：
//         10: 通用
//             如10001：参数格式校验失败
//         11: 商品
//         12: 订单
//         13: 购物车
//         14: 物流

public enum BizCodeEnum {

    TIME_OUT(500, "请求超时"),
    ACCESS_DENIED(500, "无权限"),
    USER_NOT_FOUND(500,"用户不存在或已删除"),
    USER_WRONG_PASSWORD(500,"登录失败, 用户名或密码错误"),
    UNKNOWN_EXCEPTION(500,"系统未知异常"),
    VALID_EXCEPTION(500,"参数格式校验失败"),
    SMS_CODE_EXCEPTION(500,"验证码获取频率太高，请稍后再试"),
    PARAMS_ERROR(500, "非法参数"),
    OBJECT_NULL(500,"对象为空"),
    QUERY_NULL(500,"查询结果为空"),
    REQUEST_NULL(500,"请求参数为空"),
    PRODUCT_UP_EXCEPTION(500,"商品上架异常"),
    PRODUCT_DOWN_EXCEPTION(500,"商品下架异常"),
    PRODUCT_EXCEPTION(500,"商品信息异常"),
    ORDER_EXCEPTION(500,"订单信息异常"),
    ORDER_STATUS_EXCEPTION(500,"订单状态异常"),
    CART_EXCEPTION(500,"购物车信息异常"),
    LOGINACCT_EXCEPTION(500,"账号异常"),
    LOGINPWD_EXCEPTION(500,"密码异常"),
    LOGIN_EXCEPTION(500,"登录异常"),
    LOGIN_USER_EXCEPTION(500,"用户不存在"),
    LOGIN_PWD_EXCEPTION(500,"密码错误"),
    LOGIN_TOKEN_EXCEPTION(500,"token错误"),
    DECR_STOCKNUM_EXCEPTION(500,"修改库存异常"),
    EDIT_USER_BALANCE_LOG_EXCEPTION(500,"记录用户日志异常"),
    DECR_USER_BALANCE_EXCEPTION(500,"修改用户异常");




    private int code;
    private String msg;

    BizCodeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
